package org.afs.gescol.core.model.params;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.afs.gescol.core.model.references.Cycle;
import org.hibernate.annotations.ForeignKey;
import org.scub.foundation.framework.core.model.BaseModel;

/**
 * Parameter model for school durations (number of days, hours...).
 * @author Kobla GBENYO (kobla.gbenyo@gmail.com)
 */
@Entity
@Table(name = "param_durations")
@AttributeOverrides({@AttributeOverride(name = "id", column = @Column(name = "durations_id", nullable = false)),
    @AttributeOverride(name = "version", column = @Column(name = "durations_version", nullable = false, unique = false)),
})
public class Durations extends BaseModel {

    /** Serial Version UID. */
    private static final long serialVersionUID = 4777706801884179428L;

    @Column(name = "weekly_days_number", nullable = false)
    private int dayNumber;

    @Column(name = "time_slot_max_hours", nullable = false)
    private int dailyTimeSlotMax;

    @Column(name = "daily_hours_number", nullable = false)
    private int dailyTimeTableMax;

    @ManyToOne
    @JoinColumn(name = "cycle_id")
    @ForeignKey(name = "fk_param_durations_ref_cycle_id")
    private Cycle cycle;

    /**
     * Get the value of dayNumber.
     * @return the dayNumber
     */
    public int getDayNumber() {
        return dayNumber;
    }

    /**
     * Set the value of dayNumber.
     * @param dayNumber the dayNumber to set
     */
    public void setDayNumber(int dayNumber) {
        this.dayNumber = dayNumber;
    }

    /**
     * Get the value of dailyTimeSlotMax.
     * @return the dailyTimeSlotMax
     */
    public int getDailyTimeSlotMax() {
        return dailyTimeSlotMax;
    }

    /**
     * Set the value of dailyTimeSlotMax.
     * @param dailyTimeSlotMax the dailyTimeSlotMax to set
     */
    public void setDailyTimeSlotMax(int dailyTimeSlotMax) {
        this.dailyTimeSlotMax = dailyTimeSlotMax;
    }

    /**
     * Get the value of dailyTimeTableMax.
     * @return the dailyTimeTableMax
     */
    public int getDailyTimeTableMax() {
        return dailyTimeTableMax;
    }

    /**
     * Set the value of dailyTimeTableMax.
     * @param dailyTimeTableMax the dailyTimeTableMax to set
     */
    public void setDailyTimeTableMax(int dailyTimeTableMax) {
        this.dailyTimeTableMax = dailyTimeTableMax;
    }

    /**
     * Get the value of cycle.
     * @return the cycle
     */
    public Cycle getCycle() {
        return cycle;
    }

    /**
     * Set the value of cycle.
     * @param cycle the cycle to set
     */
    public void setCycle(Cycle cycle) {
        this.cycle = cycle;
    }

    @Override
    public boolean equals(Object other) {
        return equalsUtil(other);
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }

}
